<?php

/*
 *
 *
 */
define('ABSPATH', dirname(__FILE__) . '/');
if (function_exists('xdebug_start_trace')) {
    //xdebug_start_trace(ABSPATH . 'trace.xt' . uniqid());
}
ob_implicit_flush(true);
require_once(dirname(__FILE__) . '/../include.all.php');

$def1 = new Deferred();
$def1->callback('a');
$def1->addCallback(function($data) {
	return $data . 'b';
});

$def2 = new Deferred();
$def2->callback($def1);
$def2->addCallback(function($data) {
	return $data . 'c';
});

$def3 = new Deferred();
$def3->callback($def2);
$def3->addCallback(function($data) {
	return $data . 'd';
});

$def4 = new Deferred();
$def4->callback($def3);
$def4->addCallback(function($data) {
	return $data . 'e';
});
$def5 = new Deferred();
$def5->callback($def4);
$def5->addCallback(function($data) {
	return $data . 'f';
});
$def5->addCallback(function($data) {
	var_dump($data);
	var_dump(count(debug_backtrace()));
	return $data . 'e';
});



echo "\nAll Init\n";
Tick::getInstance()->startExecution();
echo "\nAll Ended\n";
